<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>v-bind指令</title>
</head>
<body>
<div id="app">
    <!--<div class="active"></div>-->
    <div :class="classes"></div>

</div>
<script src="../vue.min.js"></script>
<script>
    // v-bind动态更新元素上的属性

    var app = new Vue({
        el: "#app",
        data: {
            isActive: true,
            error: null
        },
        computed: {
            classes: function () {
                 var o1={

                    active: this.isActive && !this.error,
                    'text-fail': this.error && this.error.type === 'fail',
                     /*<div class="active text-success"></div>*/
                     'text-success':'success'
                }
                // active: true text-fail: null
                console.log(o1);
                return o1;
            }
        }
    })
</script>
</body>
</html>